import request from '@/utils/request'

// 查询开票申请全部列表
export function invoicingListAll() {
  return request({
    url: '/basic/invoiceApply/listing',
    method: 'get',
  })
}

// 分页查询开票申请列表
export function invoicingList(params) {
  return request({
    url: '/basic/invoiceApply/list',
    method: 'post',
    data: params,
  })
}

// 查询开票申请统计数据
export function genInvoicingCount(data) {
  return request({
    url: '/basic/invoiceApply/invoiceApplyCount',
    method: 'post',
    data: data
  })
}

// 查询开票申请详情
export function invoicingDetail(invoiceApplyId) {
  return request({
    url: `/basic/invoiceApply/${invoiceApplyId}`,
    method: 'get',
  })
}

// 新增开票申请
export function invoicingAdd(data) {
  return request({
    url: `/basic/invoiceApply/add`,
    method: 'post',
    data: data
  })
}

// 修改开票申请
export function invoicingEdit(data) {
  return request({
    url: `/basic/invoiceApply/edit`,
    method: 'post',
    data: data
  })
}

// 撤销开票申请
export function invoicingRevoke(data) {
  return request({
    url: `/basic/invoiceApply/cancel`,
    method: 'post',
    data: data
  })
}

// 删除开票申请
export function invoicingDelete(invoiceApplyIds) {
  return request({
    url: `/basic/invoiceApply/remove/${invoiceApplyIds}`,
    method: 'get',
  })
}

// 查询可开票的合同
export function queryInvoiceAgreement(params) {
  return request({
    url: `/basic/invoiceApply/queryInvoiceAgreement`,
    method: 'post',
    data: params
  })
}

// 查询审批人列表
export function invoicingApproverList(data) {
  return request({
    url: `/basic/invoiceApproveDept/getUserByDeptAndRole`,
    method: 'post',
    data: data
  })
}

// 审批操作
export function approveOper(data) {
  return request({
    url: `/basic/invoiceApply/approve`,
    method: 'post',
    data: data
  })
}

// 开票操作
export function invoicingOper(data) {
  return request({
    url: `/basic/invoiceApply/invoice`,
    method: 'post',
    data: data
  })
}

// 变更发票发送状态
export function changeInvoiceSendStatus(invoiceApplyId) {
  return request({
    url: `/system/invoiceApplyWarn/changeSendStatus`,
    method: 'post',
    data: {
      invoiceApplyId: invoiceApplyId,
    }
  })
}

// 开票记录列表
export function invoicingRecordList(data) {
  return request({
    url: `/basic/invoiceApply/queryAgreementInvoiceApply`,
    method: 'post',
    data: data
  })
}

// 企查查(根据发票抬头查询企业信息)
export function qcc(params) {
  return request({
    url: `/qcc/creditCode`,
    method: 'get',
    params
  })
}
